﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = "&#4600;";
            string msg = HtmlDecode(str);
            Console.WriteLine(msg);
            Console.Read();//close window
        }

        static string HtmlDecode(string str)
        {
            int length = str.Length;
            str = System.Web.HttpUtility.HtmlDecode(str);
            int newLength = str.Length;

            while (length > newLength)
            {
                length = newLength;
                str = System.Web.HttpUtility.HtmlDecode(str);
                newLength = str.Length;
            }

            StringBuilder sb = new StringBuilder();
            foreach (char ch in str.ToCharArray())
            {
                if (!IsControlCharacters(ch))
                    sb.Append(ch);
            }

            return sb.ToString();
        }

        static bool IsControlCharacters(char ch)
        {
            bool flag1 = ch >= 0 && ch <= 31;
            bool flag2 = ch >= 127 && ch <= 159;

            if (flag1 || flag2)
                return true;
            return false;
        }
    }
}
